//egret example 1
precision lowp float;
varying vec2 vTextureCoord;
varying vec4 vColor;
uniform sampler2D uSampler;

uniform float iTime;

const float PI = 3.14159265358979323846264;

void main(void) {
	vec2 uv = vTextureCoord.xy;

	//与中心点(0.5,0.5)的距离
	float distance = sqrt((uv.x - 0.5)*(uv.x - 0.5) +(uv.y - 0.5)*(uv.y - 0.5));
	//距离越大，旋转角度越大
	float _Rot = (iTime * 3.0) * distance;
	//计算旋转角度
	float angle = atan((uv.y - 0.5),(uv.x - 0.5)) + _Rot;
	//计算坐标
	uv.x = 0.5 +   distance *cos(angle);
	uv.y = 0.5 +   distance *sin(angle);

	vec4 fg = texture2D(uSampler, uv);
	gl_FragColor = fg * vColor;
}
